package com.wbp.cms.client.user.domain;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.commons.lang.StringUtils;

import com.wbp.cms.client.common.BaseDO;
import com.wbp.cms.client.common.domain.OrganizationDO;


/**
 * @Description:
 * @Department:
 * @author andy.lhc
 * @date 2016年3月6日 下午10:09:30
 */
public class UserDO extends BaseDO {

  /**
   * 
   */
  private static final long serialVersionUID = 2178241595119728357L;

  private Long id;

  private Date createTime;

  private Date updateTime;

  private String userName;

  private String oldPwd ;
  
  private String pwd;

  private String image="";

  private String nickName="";

  private String mobileNumber="";

  private String realName="";

  private int gender;

  private String birthday="";

  private int cardType = 1; // 身份证

  private String idCard;

  private String email="";

  private String address="";

  private String telephone="";

  private Long organizationId;
  
  private String organizationName="" ;

  private String creator;

  private int version;
  
  private RoleDO  roleDO  ;
  
  private OrganizationDO  organizationDO ;
  
  private Long  roleId ;
  
  private String mainWxUrl ;
  /**
   * 生成二维码时使用 
   */
  private int width = 430 ;
  
  private int height = 430 ;

  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public Date getCreateTime() {
    return createTime;
  }

  public void setCreateTime(Date createTime) {
    this.createTime = createTime;
  }

  public Date getUpdateTime() {
    return updateTime;
  }

  public void setUpdateTime(Date updateTime) {
    this.updateTime = updateTime;
  }

  public String getUserName() {
    return userName ;
  }

  public void setUserName(String userName) {
    this.userName = userName !=null ? userName.trim() : userName ;
  }

  public String getPwd() {
    return pwd;
  }

  public void setPwd(String pwd) {
    this.pwd =  pwd !=null ? pwd.trim() : pwd ;
  }

  public String getImage() {
    return image;
  }

  public void setImage(String image) {
    this.image = image;
  }

  public String getNickName() {
    return nickName;
  }

  public void setNickName(String nickName) {
    this.nickName = nickName !=null ? nickName.trim() : nickName ;
  }

  public String getMobileNumber() {
    return mobileNumber;
  }

  public void setMobileNumber(String mobileNumber) {
    this.mobileNumber = mobileNumber !=null ? mobileNumber.trim() : mobileNumber ;
  }

  public String getRealName() {
    return realName;
  }

  public void setRealName(String realName) {
    this.realName = realName !=null ? realName.trim() : realName ;
  }

  public void setGender(int gender) {
    this.gender = gender;
  }


  public String getBirthday() {
    if(StringUtils.isNotEmpty(this.birthday)){
      SimpleDateFormat sdf =  new SimpleDateFormat("yyyy-MM-dd") ;
      try {
          Date d  = sdf.parse(this.birthday) ;
          this.birthday = sdf.format(d) ;
      } catch (ParseException e) {
        e.printStackTrace();
      }
      
    }
    return birthday;
  }

  public void setBirthday(String birthday) {
    this.birthday = birthday;
  }

  public void setVersion(int version) {
    this.version = version;
  }

  public void setCardType(int cardType) {
    this.cardType = cardType;
  }

  public String getIdCard() {
    return idCard;
  }

  public void setIdCard(String idCard) {
    this.idCard = idCard;
  }

  public String getEmail() {
    return email;
  }

  public void setEmail(String email) {
    this.email = email !=null ? email.trim() : email ;
  }

  public String getAddress() {
    return address;
  }

  public void setAddress(String address) {
    this.address = address;
  }

  public String getTelephone() {
    return telephone;
  }

  public void setTelephone(String telephone) {
    this.telephone = telephone !=null ? telephone.trim() : telephone ;
  }

  public Long getOrganizationId() {
    return organizationId;
  }

  public void setOrganizationId(Long organizationId) {
    this.organizationId = organizationId;
  }

  public int getGender() {
    return gender;
  }

  public int getCardType() {
    return cardType;
  }

  public void setCardType(Integer cardType) {
    this.cardType = cardType;
  }

  public int getVersion() {
    return version;
  }

  public void setVersion(Integer version) {
    this.version = version;
  }

  public String getCreator() {
    return creator;
  }

  public void setCreator(String creator) {
    this.creator = creator !=null ? creator.trim() : creator ;
  }

  public String getOrganizationName() {
    return organizationName ==null ? "" : organizationName;
  }

  public void setOrganizationName(String organizationName) {
    this.organizationName = organizationName;
  }

  public RoleDO getRoleDO() {
    return roleDO;
  }

  public void setRoleDO(RoleDO roleDO) {
    this.roleDO = roleDO;
  }

  public Long getRoleId() {
    return roleId;
  }

  public void setRoleId(Long roleId) {
    this.roleId = roleId;
  }

  public OrganizationDO getOrganizationDO() {
    return organizationDO;
  }

  public void setOrganizationDO(OrganizationDO organizationDO) {
    this.organizationDO = organizationDO;
  }

  public String getOldPwd() {
    return oldPwd;
  }

  public void setOldPwd(String oldPwd) {
    this.oldPwd = oldPwd;
  }

  public int getWidth() {
    return width;
  }

  public void setWidth(int width) {
    this.width = width;
  }

  public int getHeight() {
    return height;
  }

  public void setHeight(int height) {
    this.height = height;
  }

  public String getMainWxUrl() {
    return mainWxUrl;
  }

  public void setMainWxUrl(String mainWxUrl) {
    this.mainWxUrl = mainWxUrl;
  }
  
}
